﻿@using cloudscribe.Core.Models
@inject SiteContext Tenant
@using Microsoft.AspNetCore.Authentication
@using Microsoft.AspNetCore.Identity
@{
    ViewData["Title"] = "Contact";
    var contentId = "my-content" + DateTime.UtcNow.ToString("yyyy-MM-dd-hh");
    //var accessToken = Context.GetFromSession("jwt_token");
    //var accessToken = await Context.GetTokenAsync("access_token");
    string accessToken = null;
    var accessTokenClaim = User.Claims.FirstOrDefault(x => x.Type == "access_token");
    if (accessTokenClaim != null)
    {
        accessToken = accessTokenClaim.Value;
    }

}
@section Styles {
    @{ await Html.RenderPartialAsync("DatePickerBs4Css"); }
    <link rel="stylesheet" href="~/cr/css/simplemde.min.css" />
    <style>
        .editor-toolbar.fullscreen {
            z-index: 1040;
        }
    </style>



}
<h2>@ViewData["Title"].</h2>
<h3>@ViewData["Message"]</h3>

<address>
    @Tenant.CompanyName<br />
    @Tenant.CompanyStreetAddress<br />
    @Tenant.CompanyLocality, @Tenant.CompanyRegion @Tenant.CompanyPostalCode<br />
    @Tenant.CompanyPhone
</address>
@accessToken
<address>
    <strong>Email:</strong> <a href="mailto:@Tenant.CompanyPublicEmail">@Tenant.CompanyPublicEmail</a><br />

</address>


<div class="form-group">
    <textarea id="content" name="content" class="form-control" rows="10" cols="70"
              data-markdown-unobtrusive=""
              data-markdown-autosave="true"
              data-markdown-contentid="@contentId"
              data-markdown-forceSync="true"
              data-markdown-indentWithTabs="true"
              data-markdown-spellChecker="true"
              data-markdown-filemodalid="#fileBrowseDialog"
              data-markdown-filebrowseurl="/filemanager/filedialog"
              data-markdown-dropfileuploadurl="/filemanager/dropfile"></textarea>

</div>
<div class="form-group">
    <label for="Status">From date</label>
    <div class='input-group date' id='fromDateDisplay'>
        <input type="text"
               name="fromDateDisplay"
               class="form-control"
               data-bs-datepicker="true"
               data-bs-datepicker-iso-target-id="fromDate"
               data-bs-datepicker-iso-format="YYYY-MM-DDTHH:mm:ss.sss"
               data-bs-datepicker-toggle-target-id="fromDateToggle"
               data-bs-datepicker-allowinputtoggle="true"
               data-bs-datepicker-locale="@System.Globalization.CultureInfo.CurrentCulture.Name" />
        <span class="input-group-addon">
            <span id="fromDateToggle" class="glyphicon glyphicon-calendar"></span>
        </span>
    </div>
</div>
<input type="hidden" id="fromDate" name="fromDate" value="" />

<div id="fileBrowseDialog" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog modal-lg" style="height:99%;width:99%;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i title="Close" class="fa fa-close"></i></button>
            </div>
            <iframe id="frFileDialog" frameborder="0" style="overflow:hidden;height:100%;width:100%;min-height: 600px;"></iframe>
        </div>
    </div>
</div>




@section Scripts {
    <script src="~/cr/js/moment-with-locales.min.js"></script>
    <script src="~/cr/js/bootstrap4-datetimepicker.min.js"></script>
    <script src="/js/cloudscribe-datepicker-bootstrap4-unobtrusive.js"></script>

    <script src="~/cr/js/jquery.unobtrusive-ajax.min.js"></script>
    <script src="~/cr/js/cloudscribe-modaldialog-bootstrap.min.js"></script>
    <script src="~/cr/js/simplemde.min.js"></script>
    @*<script src="~/cr/js/simplemde-unobtrusive.min.js"></script>*@
    <script src="~/js/simplemde-unobtrusive.js" asp-append-version="true"></script>

}
